﻿@model IEnumerable<tutors_clus.Models.comment>
@using tutors_clus.Models;
@{
    ViewBag.Title = "Detail_Comment_ByCourse";
    Layout = "~/Views/Shared/_Layout_Private.cshtml";
}
<div id="cleft">
        @*@Model.Select(m=>m.comment.course.name_cou).FirstOrDefault()
        <ul>
            <li>@Html.ActionLink("Mục thảo luận", "Comment_ByCourse",new {id_cou=@Model.Select(m=>m.comment.id_cou).FirstOrDefault()})
            <li>@Html.ActionLink("Trao đổi với giáo viên", "Message_ByCourse",new {id_cou=@Model.Select(m=>m.comment.id_cou).FirstOrDefault()})</li>
        </ul>*@
    @{Html.RenderAction("Menu_stu_bycou", new { id_course = @ViewBag.id_cou });}
</div>
<div id="cright">
    <div class="Breadcrumb">
        <ul>
            <li>@Html.ActionLink(" ", "index", "Home", null, new { @class="home"})</li>
            <li>@Html.ActionLink("Trang của bạn", "index", "Student")</li>
            <li><a href="@Url.Action("Coures_byStudent", new { id_course=ViewBag.id_cou})">LOPMH-@ViewBag.id_cou</a></li>
        </ul>
    </div>
    <div class="post">
        <div class="postbody">
            @foreach (var item in Model)
            {
                <div class="postbodytop">
                    <h1>@item.title_com</h1>
                    <div class="infoAuthor"><span>@ViewBag.Name</span> đăng vào @item.createdate</div>
                </div>
                <div class="postcontent">@MvcHtmlString.Create(item.content_com)</div>
            }
        </div>
    
        <div class="repost">
        
            @foreach (var item2 in Model)
            {
                
                <div class="count_com">
                    <p>@item2.detail_comment.Count bình luận</p>
                </div>
                <hr />
                foreach (var item3 in item2.detail_comment)
                {

                    tutors_clubContext db = new tutors_clubContext();
                    string[] roles = Roles.GetRolesForUser(@item3.username);
                    if (roles.Contains("Student"))
                    {
                        var getFullname1 = db.students.Where(u => u.username_stu == item3.username).FirstOrDefault();
                        ViewBag.Name2 = getFullname1.fullname_stu;
                    }
                    else
                    {
                        var getFullname1 = db.teachers.Where(u => u.username_tea == item3.username).FirstOrDefault();
                        ViewBag.Name2 = getFullname1.fullname_tea;
                    }
                    <div class="repostbody">
                        <div class="infoAuthor"><span>@ViewBag.Name2</span> đăng vào @item3.createdate</div>
                    
                        <div class="postcontent">@MvcHtmlString.Create(item3.content_det_com)</div>
                    </div>
                }
            
            }
        </div>
        <div class="recomment">

        </div>
    </div>
</div>